<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 贪婪模式 
        const str = '2023-07-13';

        // ?<字符串>
        const r = str.match(/^(?<year>\d{4})-(?<month>\d{2})-(?<date>\d{2})$/);
        console.log(r);
        console.log(r.groups.year);
        console.log(r.groups.month);
        console.log(r.groups.date);
        // console.log(r[1]);
        // console.log(r[2]);
        // console.log(r[3]);








    </script>
</body>

</html>